package com.wsq.deviceinfo;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    private TextView deviceInfoTv;

    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        deviceInfoTv = findViewById(R.id.deviceInfo);
        setDeviceInfoTv();

        findViewById(R.id.dethWhile).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                while (true){
                    try {
                        int i = 100;
                        System.out.println(i);
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        });
    }

    private void setDeviceInfoTv(){
        String deviceInfo = "";
        deviceInfo += "AndroidID:" + DeviceUtils.getAndroidID(this) + "\n";
        deviceInfo += "SN:" + DeviceUtils.getSN(this) + "\n";
        deviceInfo += "IMEI:" + DeviceUtils.getImei(this) + "\n";
        deviceInfoTv.setText(deviceInfo);


    }
}